home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1997 November
/
Macworld (1997-11).dmg
/
Updaters
/
PowerKey 3.3.3 Update
/
Extras
/
External Actions
/
Beeper
/
Beeper.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-01-23
|
1KB
|
62 lines
#include<HyperXCmd.h>
#include <string.h>
#include <A4Stuff.h>
static void xcmd_param_to_string ( Handle param, char *str, short max_len );
static long xcmd_param_to_num ( Handle param );
pascal void main ( XCmdPtr pb )
{
EnterCodeResource(); // Setup base registers so we can access global variables
pb->returnValue = nil; // Setup return value field of pb
if ( pb->paramCount == 0 )
SysBeep( 0L );
else
{
long n, count;
count = xcmd_param_to_num ( pb->params[0] );
for ( n = 1; n <= count; n++ )
SysBeep( 0L );
}
ExitCodeResource(); // Restore base registers before we return
}
static void xcmd_param_to_string ( Handle param, char *str, short max_len )
{
SignedByte state;
if ((param == 0L) || (str == 0L))
return;
state = HGetState (param);
HLock (param);
strncpy (str, *param, max_len);
str [max_len] = '\0';
HSetState (param, state);
return;
}
static long xcmd_param_to_num ( Handle param )
{
long num = 0L;
char temp [256];
char *s;
temp [0] = '\0';
xcmd_param_to_string (param, temp, 255);
s = temp + strspn (temp, " ");
CtoPstr (s);
StringToNum ( (StringPtr)s, &num);
return num;
}